
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 4
 * @Author : WangRuoyu 
 * @Date : 2023/5/10 16:31
 */

#include "iostream"
#include "cstring"
#include "algorithm"

using namespace std;

int const MOD = 1e9 + 7;
int const N = 1001;
int c[N][N] = {0};

typedef long long ll;

int main() {

    int n;
    cin >> n;
    ll res = 0;

    for (int m = 0; m < N; ++m) {
        for (int n = 0; n <= m; ++n) {
            if (!n || m == n) {
                c[m][n] = 1;
            } else {
                c[m][n] = (c[m - 1][n - 1] + c[m - 1][n]) % MOD;
            }
        }
    }

    for (int i = 2; i <= n - 2; ++i) {
        res = (res + (ll) c[n - 1][i] * (ll) (i - 1) * (ll) (n - i - 1)) % MOD;
    }

    cout << res;

    return 0;
}